@echo off
setlocal enabledelayedexpansion

call setEnv.bat

echo set sh=WScript.CreateObject("WScript.Shell") >telnet_tmp.vbs

echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "%oracle_unix_user%{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "%oracle_unix_pwd%{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs


FOR /F "eol=#" %%i in (spid.txt) do (
  echo sh.SendKeys "kill -9 %%i {ENTER}" >>telnet_tmp.vbs
  echo WScript.Sleep 300 >>telnet_tmp.vbs 
)
 

echo WScript.Sleep 10000>>telnet_tmp.vbs

echo sh.SendKeys "exit{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "quit{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "{ENTER}" >>telnet_tmp.vbs

start telnet %oracle_unix_ip%
cscript telnet_tmp.vbs
del telnet_tmp.vbs

endlocal